﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using suanpan.API.Components.Providers;
using suanpan.API.Components.Config;

namespace suanpan.API.Components
{
    public static class RestChessContext
    {
        private static readonly RestChessConfig _restChessConfig = RestChessConfig.GetInstance();

        private static IConsumerProvider _consumerProvider;
        public static IConsumerProvider ConsumerProvider
        {
            get
            {
                if ( _consumerProvider == null )
                {
                    Type providerType = Type.GetType(_restChessConfig.ConsumerProviderType);
                    _consumerProvider = (IConsumerProvider)Activator.CreateInstance(providerType);
                }
                return _consumerProvider;
            }

        }
    }
}
